from Bot.bot import chatGLM
from conf.utils import remove_config

if __name__ == '__main__':
    isSetting = False
    print('聊天机器人启动,输入exit退出')
    history = [
    ]
    while True:
        try:
            inp = input('Q:')
            if inp.upper() == 'EXIT':
                break
            newMsg = chatGLM(inp, history, isSetting)
            history = newMsg.get('history')
            print('A:' + newMsg.get('response') + '\n', end='')
            if isSetting:
                isSetting = False
        except Exception as e:
            print("访问链接已过期，你重新输入你git的账号密码，需要等下一会，等弹出提示”已更新“即更新完成！")
            remove_config(str(input("账号：")), str(input("密码："))).gitRun()
            isSetting = True
            print("已更新")

    print('程序退出')
